﻿using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

namespace ThePresenter.Windows.Controls
{
	/// <summary>
	/// Interaction logic for FilmStrip.xaml
	/// </summary>
	public partial class FilmStrip : UserControl
	{
		#region Dependency property identifiers

		/// <summary>
		/// Identifies the <see cref="Presentation"/> dependency property.
		/// </summary>
		/// <value>The identifier for the <see cref="Presentation"/> dependency property.</value>
		public static readonly DependencyProperty PresentationProperty = DependencyProperty.Register("Presentation", typeof(Presentation), typeof(FilmStrip), new PropertyMetadata(new PropertyChangedCallback(OnPresentationChanged)));

		#endregion

		#region Properties

		/// <summary>
		/// Gets or sets the presentation. This is a dependency property.
		/// </summary>
		/// <value>The presentation.</value>
		public Presentation Presentation
		{
			get
			{
				return (Presentation)GetValue(PresentationProperty);
			}
			set
			{
				SetValue(PresentationProperty, value);
			}
		}

		#endregion

		#region Constructors

		/// <summary>
		/// Initializes a new instance of the <see cref="FilmStrip"/> class.
		/// </summary>
		public FilmStrip()
		{
			InitializeComponent();
		}

		#endregion

		#region Methods

		/// <summary>
		/// Called when presentation changed.
		/// </summary>
		/// <param name="d">The d.</param>
		/// <param name="e">The <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> instance containing the event data.</param>
		private static void OnPresentationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
		{
			FilmStrip This = (FilmStrip)d;
			Presentation presentation = e.NewValue as Presentation;

			//presentation.PropertyChanged += new PropertyChangedEventHandler(This.Presentation_PropertyChanged);
		}

		///// <summary>
		///// Handles the PropertyChanged event of the Presentation control.
		///// </summary>
		///// <param name="sender">The source of the event.</param>
		///// <param name="e">The <see cref="System.ComponentModel.PropertyChangedEventArgs"/> instance containing the event data.</param>
		//private void Presentation_PropertyChanged(object sender, PropertyChangedEventArgs e)
		//{
		//}

		/// <summary>
		/// Handles the SelectionChanged event of the SlidesListBox control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="System.Windows.Controls.SelectionChangedEventArgs"/> instance containing the event data.</param>
		private void SlidesListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
		{
			SlidesListBox.ScrollIntoView(SlidesListBox.SelectedItem);
		}

		/// <summary>
		/// Handles the PreviewMouseDown event of the SlidesListBox control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="System.Windows.Input.MouseButtonEventArgs"/> instance containing the event data.</param>
		private void SlidesListBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
		{
			//   http://psiman.wordpress.com/2006/12/07/reordereablelistbox/
		}

		/// <summary>
		/// Handles the PreviewMouseLeftButtonDown event of the SlidesListBox control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="System.Windows.Input.MouseButtonEventArgs"/> instance containing the event data.</param>
		private void SlidesListBox_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
		{

		}

		/// <summary>
		/// Handles the PreviewMouseLeftButtonUp event of the SlidesListBox control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="System.Windows.Input.MouseButtonEventArgs"/> instance containing the event data.</param>
		private void SlidesListBox_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
		{

		}

		/// <summary>
		/// Handles the PreviewMouseMove event of the SlidesListBox control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="System.Windows.Input.MouseEventArgs"/> instance containing the event data.</param>
		private void SlidesListBox_PreviewMouseMove(object sender, MouseEventArgs e)
		{

		}

		#endregion
	}
}
